<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/29
 * Time: 20:54
 */
include "config.php";
if ($_SERVER["REQUEST_METHOD"]=="POST"){
    if (isset($_POST["uname"]) && isset($_POST["upwd"])&& isset($_POST["uemail"])&&isset($_POST["utel"])){
        $inertSQL = "INSERT INTO userinfo (`u_name`,`u_pwd`,`u_email`,`u_tel`) VALUE(?,?,?,?);";
        //3.预查询
        $stmt = $conn->prepare($inertSQL);
        //4.绑定参数
        $stmt->bind_param("ssss", $_POST["uname"], $_POST["upwd"], $_POST["uemail"], $_POST["utel"]);
        $stmt->execute();
        if($stmt->affected_rows>=1){
            print_r(json_encode(array("status"=>1,"msg"=>"注册成功")));
        }else{
            print_r(json_encode(array("status"=>0,"msg"=>"注册失败")));
        }
        $stmt->close();
    }
}else{
    print_r(json_encode(array("status"=>-1,"msg"=>"不支持get请求")));
}
$conn->close();